package main;

import java.util.ArrayList;
import java.util.List;

public class WorkerTest {

    public static void main(String[] args) {

        Worker zs = new Worker("zhang3", 18, 3000);
        Worker ls = new Worker("li4", 25, 3500);
        Worker ww = new Worker("wang5", 22, 3200);

        List<Worker> list = new ArrayList<>();
        list.add(zs);
        list.add(ls);
        list.add(ww);
        for (Worker worker : list) {
            worker.work();
        }

        list.add(1,new Worker("zhao6",24,3300));
        System.out.println("------------------------------------------");
        for (Worker worker : list) {
            worker.work();
        }
        System.out.println("------------------------------------------");
        for (int i = 0; i < list.size(); i++) {
            if ("wang5".equals(list.get(i).getName())){
                list.remove(i);
            }
        }
        for (Worker worker : list) {
            worker.work();
        }
        System.out.println("------------------------------------------");




    }
}
